export default {
	data() {
		return {
			share: {
				title: "",
				path: `/pages/service/service`,  //默认跳转首页
				imageUrl:'../../static/image/share.png',  //可设置默认分享图，不设置默认截取头部5:4
			}
		}
	},
	onShareAppMessage(res) { //发送给朋友
	// let userInfo=uni.getStorageSync("userInfo").id?uni.getStorageSync("userInfo").id:""
	let pages = getCurrentPages(); //获取加载的页面
	let currentPage = pages[pages.length - 1]; //获取当前页面的对象
	// let url = currentPage.route + "?inviter_id=" + userInfo;//当前页面url
	let url = currentPage.route;//当前页面url
	for (let key in currentPage.options) {
		url+= `&${key}=${currentPage.options[key]}`
	}
	console.log(url,"分享路径")
		return {
			title: this.share.title,
			path:  url,
			success(res) {;
				uni.showToast({
					title: '分享成功'
				})
			},
			fail(res) {
				uni.showToast({
					title: '分享失败',
					icon: 'none'
				})
			}
		}
	},
	onShareTimeline(res) { //分享到朋友圈
		return {
			title: this.share.title,
			path: this.share.path,
			query: "weChatmoments=wxpyq",
			// imageUrl: App.globalData.imagebox,
			success(res) {
				uni.showToast({
					title: '分享成功'
				})
			},
			fail(res) {
				uni.showToast({
					title: '分享失败',
					icon: 'none'
				})
			}
		}
	},
}